/*
	This file is part of PropExtractor.

	PropExtractor is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	PropExtractor is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with PropExtractor. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _PEALICESOFTARCHIVEALD_H_
#define _PEALICESOFTARCHIVEALD_H_

namespace pe
{

	struct PEStream;
	struct PEArchiveRaw;

	struct AliceArchiveAldHeader
	{
		byte packed_toc_length[3];
	};

	struct AliceArchiveAldEntryHeader
	{
		unsigned int header_length;
		unsigned int length;
		unsigned int unknown1;
		unsigned int unknown2;
		char filename[4096];
	};

	struct AliceArchiveAldEntry
	{
		AliceArchiveAldEntryHeader* header;

		unsigned int offset;
		wchar_t* filename;
	};

	struct AliceArchiveAld
	{
		AliceArchiveAldHeader* header;

		wchar_t* workingdir;
		wchar_t* path;

		AliceArchiveAldEntry* entries;
		unsigned int entries_filled;
		unsigned int entries_total;
	};

	PE_EXPORT int AliceArchiveAldReadHeader(AliceArchiveAldHeader* a_Target, PEStream* a_Stream);
	PE_EXPORT int AliceArchiveAldReadData(AliceArchiveAld* a_Target, AliceArchiveAldHeader* a_Header, PEStream* a_Stream);
	PE_EXPORT int AliceArchiveAldOpenFile(PEStream* a_Target, AliceArchiveAld* a_Archive, unsigned int a_Index);

	PE_EXPORT int AliceArchiveAldToRaw(PEArchiveRaw* a_Target, AliceArchiveAld* a_Archive);

}; // namespace pe

#endif